package com.joysuch.wwyt.workflow.service;

import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.core.common.util.MapUtils;
import com.joysuch.wwyt.core.exception.ApiBusinessException;
import com.joysuch.wwyt.workflow.bean.SummaryInquiryQueryBean;
import com.joysuch.wwyt.workflow.bean.WorkFlowProcessTaskQueryBean;
import com.joysuch.wwyt.workflow.entity.vo.WorkFlowProcessStatVO;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

public interface WorkFlowTaskProcessListService {

    /**
     * 分页查询待办、已办、我发起的、已完成列表
     *
     * @param queryBean
     * @return
     */
    ResultBean findProcessList(WorkFlowProcessTaskQueryBean queryBean);

    /**
     * 分页查询所有列表
     * @param queryBean
     * @return
     */
    ResultBean findAllTaskList(WorkFlowProcessTaskQueryBean queryBean);


    ResultBean findAllTaskNewList(WorkFlowProcessTaskQueryBean queryBean);

    /**
     * 统计待办、已办、我发起的、已完成数量
     * @return
     */
    WorkFlowProcessStatVO findProcessStat(WorkFlowProcessTaskQueryBean queryBean);

    /**
     * 构建工作流菜单
     * @param processIds
     * @param workFlowProcess
     * @return
     */
    Map<Long, String> buildWorkFlowMenuMap(List<Long> processIds, String workFlowProcess);

    /**
     * 汇总查新列表
     * @param queryBean
     * @return
     */
    ResultBean findSummaryInquiryTaskList(SummaryInquiryQueryBean queryBean);

    /**
     * 根据label获取formjson Key
     * @param label
     * @param fromJson
     * @return
     */
    String findProcessFormJsonKey(String label, String fromJson);

    String findProcessMapFormJsonKey(String fromJson);

    /**
     * 流程引擎导出
     * @param queryBean
     * @param response
     */
    void export(WorkFlowProcessTaskQueryBean queryBean, HttpServletResponse response) throws IOException;

    /**
     * 作业票关联其它作业
     * @param queryBean
     * @return
     */
    ResultBean findTaskSimpleList(WorkFlowProcessTaskQueryBean queryBean) throws ApiBusinessException;

    /**
     * 检查导出数据是否为空
     * @param queryBean
     */
    Long checkExportData(WorkFlowProcessTaskQueryBean queryBean) throws ApiBusinessException;

    void asyncFormDataToStatisticData(Long processId, Long tenantId, String companyCode);

    void saveStatisticData(Long id, Long processId, String taskCode, String formData, String authType, String authValue, Long tenantId, String companyCode);

    String buildSearchSql(final String searchJson);

    int updateSyncStatus(Long id, boolean status);

    String findTaskFromDataValByKey(String key, String fromData);

    MapUtils.SafetyPoints findTaskFromDataoOcationByKey(String key, String fromData);
}
